package com.kgc.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.springframework.stereotype.Repository;

import com.kgc.pojo.User;

/**
 * 用户操作 接口 Mapper <一句话功能简述> <namespace的命名必须跟某个接口同名 接口中的方法与映射文件中SQL语句id一一对应>
 * 
 * @author 姓名 工号
 * @version [版本号, 2018年11月27日]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
@Repository
public interface UserMapper
{
    /**
     * 根据用户名和密码查询 
     * <一句话功能简述>
     * <功能详细描述>
     * @param user
     * @return
     * @see [类、类#方法、类#成员]
     */
    @Select("select * from smbms_user where userCode=#{userCode} and userPassword=#{userPassword}")
    public User selectUser(User user);
    
    
    @Select("select * from smbms_user")
    public List<User> selectAllUser();

    @Select("select * from smbms_user where id =#{id}")
    public User selectUserById(int id);

    @Select("select * from smbms_user")
//    @SelectProvider(type=UserDynaSqlProvider.class,method="selectWhitParamSql")
    public List<User> selectAllUserForNameAndRole(String userName, Integer userRoleId);

    @Select("select * from smbms_user where userCode = #{userCode}")
    public List<User> selectUserByCode(String userCode);

    @Delete("delete from smbms_user where id=#{uid}")
    public int deleteUserById(Integer uid);
}
